<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <title>BanchMark</title>
    <style>
        canvas {
            -moz-user-select: none;
            -webkit-user-select: none;
            -ms-user-select: none;
        }
    </style>
</head>

<body>

<div style="display: none">
    <div id="data-set-template" style="border: #00FF00 1px solid; margin-top: 10px">
        <div>
            <label style="width: 60rem">
                标签：
            </label>
            <input type="text" placeholder="标签" name="label[]">
        </div>
        <div>
            <label style="width: 60rem">
                文件：
            </label>
            <input type="file" name="myfile[]">
        </div>
    </div>
</div>


<form id="uploadform" action="upload.php"  method="post" enctype="multipart/form-data">
    <div id="data-set-forms" style="padding: 10px; border: #00FF00 1px solid">
        <div class="data-set" style="border: #00FF00 1px solid; margin-top: 10px">
            <div>
                <label style="width: 60rem">
                    标签：
                </label>
                <input type="text" placeholder="标签" name="label[]">
            </div>
            <div>
                <label style="width: 60rem">
                    文件：
                </label>
                <input type="file" name="myfile[]">
            </div>
        </div>
    </div>
</form>

<div>
    <button id="appForm">Add Data Set</button>
</div>


<div>
    <button id="getDatas">Generate BanchMark</button>
</div>

<script>
    // 获取数据
    document.getElementById('getDatas').addEventListener('click', function () {
        getDatas();
    });

    // 添加一组数据
    document.getElementById('appForm').addEventListener('click', function () {
        appendForm();
    });

    function appendForm() {
        console.log("appendForm");
        var dataSetNode = document.getElementById("data-set-template").cloneNode(true);

        document.getElementById("data-set-forms").appendChild(dataSetNode);
    }

    function getDatas() {
        var form = document.getElementById('uploadform');
        //再次修改input内容
        form.submit();
    }
</script>
</body>

</html>
